package com.bdqn.t382.controller;

import com.bdqn.t382.entity.SysUser;
import com.bdqn.t382.service.SysUserService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

@Controller
public class UserController {
    @Autowired
    private SysUserService sysUserService;

    @RequestMapping("/user")
    public String user(Model model) {
        model.addAttribute("name", "zhangsan");
        model.addAttribute("age", "20");
        return "user";
    }

    @RequestMapping("/list")
    public String list(Model model) {
        List<SysUser> list = sysUserService.findList(new SysUser());
        model.addAttribute("list", list);
        return "list";
    }
}
